/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package banaanvraag.tools.lists;

import java.util.ArrayList;

/** Finally an ArrayList that accepts an array as content at the constructor!
 *
 * @author Luc
 */
public class AdvancedArrayList<T> extends ArrayList<T>{
    
    /** Create an AdvancedArrayList
     * 
     */
    public AdvancedArrayList() {
        super();
    }
    
    /** Create an AdvancedArrayList from an array
     * 
     * @param array The array to fill the list with
     */
    public AdvancedArrayList(T[] array) {
        super();
        int i = 0;
        while(i < array.length) {
            add(array[i]);
            i++;
        }
    }
    
    /** Add an array to the list
     * 
     * @param array The array to add to the list
     */
    public void addArray(T[] array) {
        int i = 0;
        while(i < array.length) {
            add(array[i]);
            i++;
            
        }
    }
    
    public void assureSize(int targetSize) {
        while(size() < targetSize) {
            add(null);
        }
    }
}
